-
Notifications
You must be signed in to change notification settings - Fork 918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Add integration test for /var mounts #6033
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TheRealFalcon, this is looking really nice! I left some nitpicks below.
crit_chain = client.execute( | ||
f"systemd-analyze critical-chain {service} --fuzz=60" | ||
) | ||
assert "var.mount" in crit_chain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a failure message here? Currently when this fails we see:
assert 'var.mount' in 'The time when unit became active or started is printed after the "@" character.\nThe time the unit took to start is printed after the "+" character.\n\ncloud-init-...
Which is a bit cryptic without context
f"systemd-analyze critical-chain {service} --fuzz=60" | ||
) | ||
assert "var.mount" in crit_chain | ||
assert crit_chain.find("var.mount") > crit_chain.find(service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if it offered a machine readable output format, but that doesn't seem to be the case (yet?).
If the service isn't available on in the critical chain, we would get a false positive (PASS) on this test. There would be bigger issues at play, but for easier maintenance I think that failing in that case would be more correct.
That said, I think that systemctl list-dependencies --all {service}
would be more correct than using the critical chain, right?
Also, same comment as above about explaining why the failure matters.
Would you mind checking cloud-init logs/status here too, just for good measure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we'd get a false positive, but I think systemctl makes more sense than some arbitrary fuzz value so I'll do that. +1 to everything else here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we'd get a false positive
str.find(sub[, start[, end]])
...
Return -1 if sub is not found.
-1 would be smaller than the integer returned by crit_chain.find("var.mount")
da23e18
to
d2e19db
Compare
@holmanb I believe I addressed your comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @TheRealFalcon!
Proposed Commit Message
Additional Context
Test Steps
Merge type